$(
  function(){
    // Main navigation selector
    var navSelector = "ul#menu li";

    // Rounded corners
    $('.box-container').corners("5px bottom");
    $('.box h4').corners("5px top");
    $('ul.tab-menu li a').corners("5px top");
    $('textarea#wysiwyg').wysiwyg();

    // Colorbox stuff
    $("div#sys-messages-container a, div#to-do-list ul li a").colorbox(
      {
        fixedWidth: "50%",
        transitionSpeed: "100",
        inline: true,
        href: "#sample-modal"
      }
    );

    $('#to-do').tabs();
    $("#calendar").datepicker();
    $("ul.list-links").accordion();


    $(navSelector).find('a').css(
      {
        backgroundPosition: "0 0"
      }
    );

    // Animated dropdowns
    $(navSelector).hover(
      function() {
        $(this).find('ul:first:hidden').css(
          {
            visibility: "visible",
            display: "none"
          }
        ).show("fast");
        $(this).find('a').stop().animate(
          {
            backgroundPosition: "(0 -40px)"
          },
          {
            duration: 150
          }
        );
        $(this).find('a.top-level').addClass("blue");
      },
      function() {
        $(this).find('ul:first').css(
          {
            visibility: "hidden",
            display: "none"
          }
        );
        $(this).find('a').stop().animate(
          {
            backgroundPosition: "(0 0)"
          },
          {
            duration: 75
          }
        );
        $(this).find('a.top-level').removeClass("blue");
      }
    );
  }
);